import {
  BaseEntity,
  Column,
  Entity,
  PrimaryColumn,
  PrimaryGeneratedColumn,
} from 'typeorm'

// name参数是使用的表名称
@Entity({ name: 'user_info' })
export class UserInfo extends BaseEntity {
  // 自增主键
  @PrimaryGeneratedColumn({ type: 'int', name: 'id' })
  id: number

  // 用户id
  @PrimaryColumn({
    type: 'int',
    name: 'userId',
  })
  userId: number

  // 真实名称
  @Column({
    type: 'varchar',
    name: 'realName',
    nullable: true,
  })
  realName: string

  // 1 男 2 女
  @Column({
    type: 'varchar',
    name: 'sex',
    nullable: true,
  })
  sex: string

  @Column({
    type: 'int',
    name: 'orgId',
  })
  orgId: number

  @Column({
    type: 'varchar',
    name: 'orgName',
  })
  orgName: string

  @Column({
    type: 'varchar',
    name: 'email',
    nullable: true,
  })
  email: string

  @Column({
    type: 'varchar',
    name: 'userName',
  })
  userName: string

  @Column({
    type: 'varchar',
    name: 'phone',
    nullable: true,
  })
  phone: string

  @Column({
    type: 'varchar',
    name: 'roleName',
    nullable: true,
  })
  roleName: string

  @Column({
    type: 'varchar',
    name: 'roleCode',
    nullable: true,
  })
  roleCode: string

  // 是否禁用
  @Column({
    type: 'tinyint',
    name: 'disable',
    nullable: true,
  })
  disable: boolean

  // 是否删除
  @Column({
    type: 'tinyint',
    name: 'isDelete',
    nullable: true,
  })
  isDelete: boolean
}
